import Vuex from 'vuex';
interface IStore {
  courseInfo: any;
  currentIndex: number;
  completeIndex: number
}
export default new Vuex.Store<IStore>({
  state: {
    courseInfo: {},
    currentIndex: 0,
    completeIndex: -1
  },
  mutations: {
    set_course_info(state, payload) {
      state.courseInfo = payload;
    },
    set_current_index(state, payload) {
      state.currentIndex = payload;
    },
    set_complete_index(state, payload) {
      state.completeIndex = payload;
    },
    reset(state) {
      state.courseInfo = {};
      state.currentIndex = 0;
      state.completeIndex = -1;
    }
  }
});
